<?php
/**
 * HTML视图
 * 
 * 使用PHP 语法定义的HTML视图
 * 
 * @author Leo Ning <leo.ning@like18.com> 2010-11-14 12:25
 * @version 1.0
 * @since 1.0
 * @copyright 2008-2011 LIKE18 INC.
 * @package view
 */
class HtmlView extends View {
	const EXT = '.html';
	/**
	 * 绘制
	 * @param Action $action
	 * @param string $module
	 * @return string
	 */
	public function render($action, $module) {
		$tpl = MODULE_PATH . $module . DS . 'views' . DS . $this->tpl . HtmlView::EXT;
		$data = $this->data;
		if (is_file ( $tpl )) {
			extract ( $data );
			@ob_start ();
			include $tpl;
			$content = @ob_get_contents ();
			@ob_end_clean ();
			return $content;
		} else {
			Response::error ( 'The view template ' . $tpl . ' is not found', 404 );
		}
	}
	public function setHeader() {
		@header ( 'Content-Type: text/html' );
	}
}